package com.hackordie.commons.hardware.components;

import java.util.Random;

import com.hackordie.constants.EComponentsType;

public class Firewall extends AComponent {

    private int accesKey;
    private int dificultAccess;

    public Firewall(String componentName, int energyToTurOn, int dificultAccess, int prize) {
        super(componentName, EComponentsType.Firewall, energyToTurOn, prize);

        this.dificultAccess = dificultAccess;
        generateAccesKey();
    }

    public int getDificultAccess() {
        return dificultAccess;
    }

    public void setDificultAccess(int dificultAccess) {
        this.dificultAccess = dificultAccess;
    }

    public int getAccesKey() {
        return accesKey;
    }

    // functions

    public void generateAccesKey() {
        if (started) {
            Random random = new Random();
            accesKey = random.nextInt(10 * (dificultAccess * 10));
        }
    }
    
    @Override
    public String toString() {
        
        return super.toString() + "-" + 
               accesKey + "-" +
               dificultAccess; 
    }

}
